package boddaert.philippe.cashGame.comparator;

import boddaert.philippe.cashGame.GameConfiguration;
import boddaert.philippe.cashGame.GameConfigurationCurrencyType;

public class GameConfigurationComparator {

	public static double compare(GameConfiguration config1,
			GameConfiguration config2) {
		if (config1 == null) {
			if ((config2 == null) || (config2.getBestPrice() <= 0))
				throw new IllegalArgumentException();
		} else {
			if ((config1.getBestPrice() <= 0) || (config2 == null)
					|| (config2.getBestPrice() <= 0))
				throw new IllegalArgumentException();
		}
		if (config1.getType().equals(GameConfigurationCurrencyType.POINT)
				|| config2.getType().equals(GameConfigurationCurrencyType.POINT))
			return (config1.getBestPrice() / config2.getBestPrice());

		throw new IllegalArgumentException("No configuration in point was found");
	}

}
